package com.jmp.autocofiguration.web.interceptor;

import com.jmp.feign.LogFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
@Async("asyncServiceExecutor")
@Slf4j
public class LogAddEventListener {
    @Autowired
    private LogFeign logFeign;

    @EventListener
    public void hanldeEvent(LogAddEvent event) {
        log.info("log add");
        logFeign.add(event.getLogAddRequest());
    }
}
